They need enough to test. I would hire an attorney. Doubt if they had probable cause to even search you.
The response given is not intended to create, nor does it create an ongoing duty to respond to questions. The response does not form an attorney-client relationship, nor is it intended to be anything other than the educated opinion of the author. It should not be relied upon as legal advice. The response given is based upon the limited facts provided by the person asking the question. To the extent additional or different facts exist, the response might possibly change. Attorney is licensed to practice law only in the State of Alabama. Responses are based solely on Alabama law unless stated otherwise.
There are a number of legal and factual issues here. The law regarding "search and seizure" is paramount, and if you did not give the police officer consent to search, there may be a valid basis to challenge the seizure of the pipe. If the pipe was used or intended for the use of illegal substances, such as marijuana, that constitutes the separate crime of 'Possession of Paraphernalia.' That crime is a Class A misdemeanor offense.
Your best course of action is to seek the professional services of a qualified criminal defense attorney to assist you. You should not rely on a 'court-appointed' lawyer for representation and under Alabama law, you might not be eligible for court appointed counsel, depending on the district court's interpretation of indigent status. For a listing of qualified attorneys, check the listings under the Avvo section of 'Criminal Defense.'
The pipe alone is enough for a paraphernalia charge. The residue could almost definitely get you for possession as well. The amount of the drug required is pretty irrelevant unless you're charged with trafficking. If there is marijuana in the pipe, no matter how insignificant, you're in possession of it on your person.
Your title is a little misleading. An officer can pat you down for Officer safety and when he feels something, like a pipe, that is obvious to him to be illegal he can get you to take it out.