An execution often suggests a violent conclusion. Its secondary meaning (completing a duty or task) has more resonance with the spiritual significance of such a dream.
Psychological / emotional perspective: There is a sense of coercion – of having to – in the idea of execution of a task.
If we tend to be driven by our emotions this will come across in dreams | violence of any sort in dreams usually signifies that something is badly out of balance, so to dream of an execution may signify that we are acting (wrongly) more from an intellectual viewpoint than from a feeling perspective. You might also like to consult the entries for guillotine, punish / punishment and violence.