Well in that case your answer is drugs. Simply DM fiat that there's a fairly unknown combination of fairly common herbs that, prepared correctly and mixed with pure water, inhibits spellcasting. The guards just dump a bunch down the well in the courtyard every week. Doesn't work if you drink wine or beer, doesn't work if you boil it as tea, doesn't work if you add anything extra or the water has minerals in it. Takes about three or four days to wear off once you stop drinking the water.

Your other options in modern D&D are either mutilation & torture, covering the whole place in DM fiat antimagic, or going full on high end magic-as-technology modern style incarceration.