Feeding 12V Pulse into Microcontroller 5V - Use a Transistor?
You cannot use the NPN in this fashion.  When the base of Q1 is greater than the collector voltage by 1 diode, you will forward bias the base-collector junction.  This is not a normal operating point for the transistor and depending upon the impedance of the 5V node could cause excessive current flow through this path and damage Q1.

If all you want to do is feed a 12V signal into a 5V MCU pin, a simple resistive voltage divider should suffice.