Best way to get +5V or +12V or 0V from arduino pin
Here is a circuit that should work:



Your basic idea of using a high side PNP switch was fine.  The problem with it is that this exposes the high voltage to the micro pin.

In this circuit, Q2 is the high side switch that turns the 12V output on or off.  Q1 switches the high side switch, thereby isolating the micro from the 12V on the base of Q2.

When the base of Q1 is held at 5V, the emitter will be 4.3V, so there will be 1mA thru R1.  Most of this also flows thru the collector of Q1, which thereby acts like a switchable 1mA current sink.  Most of this can only come from the base of Q2.  Figuring the two transistors each have a gain of at least 50, then the output is good for at least 45mA for Q2 to stay in saturation.  The purpose of R3 is only to make sure Q2 is really off when Q1 is off.