voltage selector circuit for programming microcontrollers
From what I understand of your current solution, VPP (when ON) is fed through a resistor. I don't think this is a good idea. If this resistor has a too high value and the MCU draws significant current from VPP, the voltage drop will be too high and the MCU may reset itself. But if you lower the resistor value, the current wasted when VPP is 0V will become too high. Instead, you should feed VPP through a PNP transistor.

Anyway, here is a basic solution, just using simple components:



You can choose whathever voltage to feed VPP with (either 12V, 5V, or GND) by setting the corresponding control input line to high level. There is nothing really particular in this circuit: for both the 12V and 5V paths, there is a NPN + PNP couple that act as a level shifter. Then, for the GND path, just the NPN as you initially did. The only trick is the D1 diode to prevent backfeed of the 12V to the 5V supply and reverse biasing the 5V PNP emitter, when VPP is 12V. Use a schottky diode for lower drop.

Note: do not set both one of SET_xV and SET_GND to high level at the same time!