A common scenario involves 2 or more people who are stopped for a traffic violation. The police end up searching the car and finding dope - such as marijuana, cocaine, methamphetamine, or some other controlled substance. The police arrest everyone, and you want to know how to get your case dismissed. The question is usually whether your friend can either go to the police or prosecutor and sign something claiming the contraband was his, and whether that will be enough to get your case dismissed. The answer is probably not.
To understand the answer, you need to understand the law. No matter what the substance is, the law prohibits "possession". Possession has a specific meaning, and it is not limited to ownership. Ownership is generally limited to one person; for example, only one person generally owns a car or some other item of property. Possession is different though, and more than one person can possess something. The legal definition is "care, custody or control." In most drug cases, the issue comes down to who had access to the drugs.
There's also another element, and that is that the possession must be knowing or intentional. In other words, you must know the drugs are there, and in some cases, know they are drugs.
A common situation involves marijuana possession. The officers make a stop and smell marijuana. They then search the car and find a baggie of marijuana in the front seat. They are going to assume that everyone in the car was smoking, and therefore everyone had possession of the weed. One person can claim ownership, but that usually is not going be enough. If they don't smell marijuana (which almost never happens) and the marijuana is is not plainly visible, you have a better chance.
You might wonder what happens if you are in a car, and your friend brings out a bag of marijuana - which you didn't know about - and everyone but you starts smoking. Since the police assume everyone knew about the marijuana and was using it, you are going to have an extremely difficult time convincing a prosecutor that you aren't just as guilty as the others. By the way, the teaching point for that is to choose better friends.
The last example illustrates another factor you must be aware of, which is that prosecutors don't usually believe people who admit the drugs are theirs. You probably think that doesn't make any sense, since they are admitting guilt, and I would probably agree with you. However, they look at it as one person who knows they are guilty trying to help a friend out. They don't have anything to lose, so why not try to do something for someone else. I've seen some pretty dramatic examples of this. In one case, an apartment owner came into court and admitted under oath that the cocaine belonged to them. They had no deal, and the case against them wasn't that strong; they were coming in and subjecting themselves to the possibility of going to prison. Not only did the prosecutor not believe them, but the jury also didn't believe them.
So, what's the lesson here? Apart from choosing good friends, the lesson is to not think you have nothing to worry about if your friend claims responsibility for the dope. Even if they follow through on that after hiring a lawyer, the prosecutor is probably still going to pursue the case against you. Don't count on a dismissal. Instead, hire your own lawyer, who will know the arguments to make to protect your interests.