I'm going to repost AbZy's original comment:
Use parametrized queries
You responded with:
sorry I can't help it as I'm working on a complex piece of code which i can do so much to make changes, that's why i'm asking if there's any other way to catch the exception than going through every single bit changing the queries all over again which would take days :(
That's not a good enough reason to avoid doing the work, unless this is an application which you're planning to throw away soon.
If you (or the original authors) write lots of bad code which is vulnerable to SQL injection attack, it will indeed take you a while to fix properly. That doesn't mean you should just try to patch it by detecting "bad" input. Sooner or later someone's going to need to include an apostrophe (e.g. to include a name such as "O'Neill") - at which point you'll have to do more work. At that point you might say "Well I won't detect the apostrophe - I'll escape it" - which will take you a while to do "mostly correctly" and you'll still end up with a system which is almost certainly vulnerable to attack, but in a more subtle way.
Using parameterized queries is the way to fix this. Any time you spend trying to take shortcuts to avoid fixing the problem properly is simply wasted time. Bite the bullet, and do it now. Maybe you need to "down tools" and do nothing else until this is fixed - or maybe you can pick off one query a day to fix, getting on with other features at the same time. Either way, I don't think you should spend any more time just ducking the issue.
Before you respond saying you can't go ahead and fix the issue properly, work out what's preventing this, and how you can remove those blockages. Is your management aware of the current risk (which goes well beyond just the server crashing, of course)? Is the problem that you feel you don't have the time to commit to fixing it, or some other obstacle? Is it political or technical? Again, I'd urge you to consider the long term benefit of the application. I've seen lots of situations where people have made a short term "hacky" fix and regretted it - but I can't remember ever seeing someone regretting doing the right thing for code which still has a significant period of life left, painful as it can be in the short term.