I have a new prescription for xanax because of newly diagnosed anxiety attacks. I don't want to start taking if it will have a negative impact my testimony.
You should be sure that your lawyer (or the lawyer calling you as a witness) knows about your anxiety so they can help you feel comfortable.
In general, it's not a good idea to try new medications right before testifying. If you've taken it in the past and feel that it does not adversely affect your ability to listen, remember, and answer questions, then you can take it, but be prepared to disclose the fact that you have taken it if you are asked.
I agree with my colleague. One of the first questions I always ask at a depo is whether the deponent is on any medications that would prevent them from giving their best testimony. For a usual dose of Xanax, I wouldn't think that it would adversely affect your testimony, and it would ease your anxiety, so I think it's ok that you take it, but be prepared to disclose it to the lawyers.
Disclaimer: Please note that this answer does not constitute legal advice, and should not be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue. This answer does not create an attorney-client relationship.
I am not a medical doctor and agree with attorney Koslyn's answer. If you've never taken it before talk to your doctor about how it might impact you. Also, if you are a party to the action, then talk to your attorney about it as well.