But there are other things these agencies do wonderfully.
A) When you have a real hint, and even if it is just a competitor, you can employ lots of fighting power, technology etc to track them. This in itself is already worth much. Think about bugging another country's chancelor's phone. Awesome!
B) Scaring your own population into behaving. If you think you are observed all day by CIA, FBI and NSA you are more likely to do stupid things that harm the common piece.
C) Doing things that would be illegal for the government, like funding dictatorships delivering weapons to drug lords, etc.
So I think even if everybody knows that spies don't really succeed as much as people thought we will still continue to have spy agencies.