It would be almost impossible to maintain a sterile environment within a prison, with the only exception being the Super Max. However, we should expect public employees to not contribute to the contraband flow into prisons.
So far there's no fool-proof way of doing that because of the different levels of security that prisons are assigned. Other than only building Super Max prisons, and keeping inmates locked in their cells 24/7, with no contact with anyone other than officers, no contact visits, not even with their lawyers, no packages allowed to be brought in on visits, no packages allowed to be sent into the facility from family or friends, no catalog orders by inmates, no commissary buys, no phone calls, no mail, no vocational or educational classes, no religious services, no outside volunteers coming in for AA, or other group meetings, no access to library, law library or recreational programs, no outside medical trips, or hospital stays, no funeral visits, no nothing. And what do you think the courts would do with that? All the things inmates are allowed to have access to were all brought about by the courts.