Significant reflavoring of necromancy would be needed in many fantasy worlds for it to not be so bad, or as some have mentioned above, the view of undead by the society in that world would need to be different than what we're currently used to.
I could see a world where necromancers first speak with the dead, gain their consent in helping with some task, and then raising them to help with the task on a sort of contractual basis. Perhaps in this world, the dead are still anchored to their remains in some way, even if they are actually in some sort of afterlife realm.
On a vaguely related note, I dislike the "army of the dead" style necromancer. A third-party made a playbook for Dungeon World that instead of raising armies and being limited to skeletons and zombies and other named undead, could raise whatever dead things they came across but could only have one undead servant, usually. I actually really like that flavor and feel it's somehow more palatable than the mass raising variety. I could see this is a reworked subclass for Wizard in 5E that gets this ability outside of spell-casting.
EDIT: Maybe just also never take the undead into towns and only utilize them in fights outside of civilized society, such as in dungeons.