Prior to 3.5e creating undead was not necessarily an evil act. At the very least, the spells involved did not have an evil descriptor - that was added in 3.5e. Similarly, until 3.5e (and, technically, even in 3.5e) negative energy is not evil. It is as purely neutral as positive energy, force, fire, air, water, earth, acid, cold, lightning, etc. Note that Cure spells do not have a 'good' descriptor, and Inflict spells do not have an 'evil' descriptor.
Thus, whether or not creating undead is innately evil (as in having an evil spell descriptor) seems to vary from DM to DM. All but one that I have played under have removed the evil descriptor from the spells as an automatic houserule. I note that the one that did not first started playing under 3.5e D&D, so he - unlike the others - never knew a time when it did not have that descriptor. All that started playing prior to 3.5e removed the evil descriptor from those spells.
Personally, when I GM I play it like this:
Some undead return on their own. They have tasks unfinished, etc. They may return as ghosts or revenants (a wight variant in our games, don't know if an official creature exists with that name or not). They have the alignment they did in life, they are remarkably difficult to destroy (although exorcism can potentially permanently send them into the afterlife), and they leave / cease to exist (as ghosts / revenants) as soon as their task is complete. Often they are limited in various ways (reminders of how they died can act as wards against them, for example; some cannot leave certain locations or must be near / follow certain items or individuals, etc).
Spells can force a spirit to return, perhaps even forcing it into a corpse. They are treated as if Dominated until the spell wears off - which may require the death of the caster or the destruction of some object used in the ritual that called them. Being dominated, they can act in ways quite different from their former alignment, although this does not affect their alignment (usually, unless Tainted). Non-mindless undead always require a non-mindless spirit (from a sapient being). Note that geases can also force a spirit to return to fulfill its purpose.
Often Necromancers will call upon animal spirits for 'mindless' undead - usually even slaying the animal at the time of the creation of the undead, binding its spirit to the corpse / skeleton intended. Most neutral necromancers follow this route - and use skeletons as they are less identifiable as a given specific individual and are thus more readily accepted by a populous (than the rotting corpse alternative that might possibly be identifiable). Typically the corpses of criminals executed for major offenses are used in such instances - and the practice of using mindless skeleton undead is strictly regulated by whatever kingdom / city-state / republic (ie: rome style, not modern style) the necormancer happens to be in.
Only a few locations allow the creation of non-mindless undead from these skeletons - a sort of decades or even centuries long community service, I suppose. Most view it with extreme suspition as there is a rare but potential chance that one day the skeleton might resist / break its domination. In specific, any time command changes between wizards there is a chance of freedom, and freedom is certain if the one holding the domination dies without having passed on command to another. Non-mindless skeletons are often marked so that if they break free of their domination they will be more readily identifiable from the mindless workers. However, as such are uncommon in the few places where they even exist, it is unlikely that most outside such communities would even recognize what the markings meant.
In addition to these undead there are the Tainted Undead. These are spirits or corpses affected by Tainted influences. All 'contageous' undead - vampires, ghouls, wights, etc - fall under this category. All (even the wights) must consume life force in some manner. The wights take it directly by touch, the Vampire consume it via blood, and the ghouls absorb it through the flesh they eat from still living or even recently deceased victims. The creation of such blasphemies is outlawed by every religion, as it was the Fiends that are the initial origin of such Taint - and only through the use of Taint can such a creature be created.
(Note, I use a variant cosmology - one in which all fiends are Tainted and on one side of existence and all deities (regardless of AL) are non-Tainted and on the other side of existence. Each is weakened as they move towards the other side - with the Prime being in the center. On it the least Imp cannot exist and the greatest Fiendlord is little better than an average fiend. Similarly, the least celestial cannot exist on the Prime and the least deities are no more powerful than typical celestials. Greater deities tend to warp existence. They can't pass through the Prime to the other side without leaving global cataclysms in their wake. This would destroy most of their worshippers - and leave them notably weaker. Most of the greater Fiendlords were originally powerful deities that made it to the other side but were so weakened by the loss of so many worshippers that they were easily overcome by the fiends - and Tainted with their essence. Taint is merely another tool of the Fiends to gain more 'followers' - an experiment not quite gone as intended that corrupts those affected but does not change them into Fiends. Mortals that die Tainted always rise as Tainted undead.)
Creation of a Tainted undead is always an evil act, as it only serves the evil Fiends that are the source of Taint. While such are always initially in the control of their creator, eventually the creator dies or leaves the plane and the control is lost. Also, as the control is akin to domination there is always a chance that control may one day be lost due to some chance incident. It doesn't matter much, however, as Taint always warps and corrupts the soul, twisting alignment towards Evil. Those that resist most may avoid corruption at the cost of their sanity or possibly the destruction of their soul / awareness - becoming mindless in the latter instance.
Non-Tainted undead 'live' off of positive energy, while Tainted undead 'live' off of Negative Energy. This energy, however, is destructive in nature. To prevent their own slow destruction they must consume living essence. Positive energy in its raw form reacts with their negative energy, harming them. A less pure form of negative energy, however, can both lessen the dangerous negative energy that infuses them and grant them enough 'life' to continue their existence. If they don't consume life the negative energy in them may reach dangerous levels, slowly destroying them from within to keep them going (rather like a starving person's body will eventually canabalize its own muscles to keep the overall body alive).
It's a delicate balance they must maintain. Too much or too pure positive energy could potentially wipe out their negative energy - destroying the force that grants them animation / existence. Too little and the destructive force will begin weakening them (permanent hp loss until life is consumed) until they 'die.' Vampires can use stupor to avoid this for a time - reducing loss to a few hp a year instead of a day.
This is merely how I treat undead IMCW. Others have their own ways of dealing with them. For your own campaign world you need to decide for yourself. Do you use the same cosmology as core D&D (ie: the Great Wheel, or perhaps the Faerun Tree or the Eberron Atom)? Is Negative Energy innate neutral or evil? What exactly happens when an undead comes into existence? Are their different ways for such to occur - such as naturally, only due to a spell (including geas) or spell-like / supernatural ability, or some combination of these? How are such viewed in the world? How are those that traffic in such viewed (ie: necromancers, etc)?