Don't tell the judge you found the shit in a park. The judge will think you're just a lying dope fiend. Tell the judge the truth. You don't have to say HOW you got it because they don't care. Tell the judge that you've been to your doctor for anxiety medication and you were prescribed medicine that made you sick. Then tell the judge that you did research on the internet for things that would help the stomach upset and coincidentally
marijuana was near the top of the search results.
Look into the judges eyes with respect and show a little fear, but don't be cocky and/or shifty. Be VERY expressive about your respect for the law and NEVER interrupt the judge, public defender, cop, or da. If the judge says something to you expressing his/her opinion, do not argue with the judge. In fact, avoid coming across to the judge as ANY kind of aggressive character. Do not throw your hands around if you are upset about something said. Be calm, listen, acknowledge, and don't make yourself out to be a liar.
I will say that Texas is a state with harsher laws regarding
marijuana possession, but keep in mind... you only had 2 grams. Make sure your public defender knows that 2 grams is basically 3 joints. If the judge asks you why you had it with you while driving, tell him/her that you have someone at home who has strong feelings against drugs in general and you don't want to hurt that person. This will tell the judge that you have respect for other people and you're not a bad guy.
Before hand, ask your public defender if he/she can call a private session in the judge's chambers if the public defender doesn't feel like things are going smooth. It's unlikely that the judge will go for it, but if the judge does, your public defender can speak to the judge on your behalf and interject things you may not be able to think of when you're in front of the judge. Pressure is a bitch - it can cause you to do or say things you wouldn't normally do or say. That's why you have to say in the back of your mind REPEATEDLY "Whatever happens today will have no long term affect on my happiness!".