Workflow code has to be deterministic. To make changes in your workflow code (for long-running workflow for example), take a look at workflow versioning (docs, video).
Removing an activity invocation (that was already executed) without versioning would result in non-deterministic errors that would block your workflow execution.
You can test if changes in your workflow would result in non-deterministic errors by using WorkflowReplayer, which SDK are you using?