How do I kill a (summoned with commands) named Ender Dragon? [duplicate]

Teleport or fly over to it, then:

/kill @e[type=EnderDragon,c=1,r=2]

If it's a hostile mob, setting the gamemode to peaceful should do the trick.