Possession of a Controlled Substance is a felony in Texas. If you possess less than two ounces, then it is a State Jail Felony. However, it can be enhanced for a number of reasons, including but not limited to possession in a Drug Free School Zone.
There are a number of different ways to get such a case dismissed or obtain an acquittal. One, the state has to prove beyond a reasonable doubt at trial that the drugs were in your care, custody, and control. But, before the case even gets to trial the state will have the burden of proving that the reason the police came into contact with the suspect was supported by probable cause.