If a shul has prominent, armed security, I think any antagonist will go to another shul down the block.
IMO that's the only point of a security guard. He's a deterrent meant only to harden the target.
Truth is, if any terrorist or terrorist group truly wanted to carry out an attack, figuring out out to take out the guard or slip past him unnoticed would not be all that difficult. At that point, we can only rely on Hashem's protection.