I've done some googling and looked through the list of Actor Values and this here: http://www.creationkit.com/Category:Papyrus and wasn't able to find a way to create a magic effect (with or without script) that changes the target's gender. I briefly looked into SKSE but didn't find anything on that matter there, either. Is there actually no way to create something like the "sexchange" console command with scripts?