Yes they do register on a piss test. I used to have to be the poor bitch that had to do drug testing on people as part of my job. I hated it.
If you do test positive on any licit drug, you'd better have a perscription for it. What will happen is that you will be contacted by your PO and asked to explain yourself. As long as you show them proof (like the RX pill bottle the drug came in) that you have a perscription from an MD, there is nothing they can do about it.
I would however, be careful. I mean try to make it look like your're not taking 10 pills a day by bringing in an empty bottle that was filled yesterday. Know what I mean? If your're taking someone else's perscription and you already took the test, your're toast.