Depends on one factor: whether they've acted on their urges or not.
Contrary to everyone's beliefs, just because they're attracted to children doesn't make them any more unsafe than a heterosexual person. Their urges - if acted upon - are of course dangerous. But, if they can control them like any other human being, then it's not worth killing them over. They should receive psychiatric treatment instead.
If, however, a pedophile acted on their thoughts, which is basically like a rapist too (except the victim is a child which makes it worse), then execute them.
We all have urges, thoughts, and attractions. Some people fantasize over animals. But, they require treatment. We shouldn't go around killing everyone for what they're attracted to, irrespective of how vile it is. Otherwise, we may as well kill each other. We're all attracted to something i.e. homosexuals, bisexuals, asexuals etc. We all have the ability to act out on these too, forcefully, like a rapist. But we chose not to, like some pedophiles too.
Overall, they should be treated. But if they've carried anything out, then kill them.