I’ve got a new idea on how to keep the big bad from being resurrected, just gotta give their corpse a cute little heart piercing! When all the flesh regrows around it, the piece of metal installed there will quickly re-kill them.
The typical TV / movie / videogame answer to that is that any foreign objects are pushed out of the body as part of the resurrection. I don't know how that wold work if you resurrected someone who's currently locked inside an iron maiden.
One of the joys is that top and bottom surgery are necessary only in a world without magic or magic-level tech. Trans folk in worlds with resurrection spells don't get surgery, they drink a potion or wear a girdle, and get a really rather complete transformation, including the capacity to bear / sire children.
Will resurrection reverse a magical sex-change transformation? Depends on how the spell works out how to restore you, and if the sex change is material or a magical construct, like an illusion.