If you are not going to change your code, you can only intercept requests. Since there is no such thing as a good or bad SQL command, you are quite limited in settings, but you can try to reject several queries that are initiated from one line. In other words:
LEGAL
SELECT * FROM foo WHERE bar='baz';
ILLEGAL
SELECT * FROM foo WHERE bar=''; DELETE * FROM foo; SELECT 'baz';
Since almost every injection for injection requires several requests in one request and provided that your application does not require this feature, you can just get away from it. It probably won’t catch every type of attack (you may have a lot of damage that you can use with subqueries and functions), but it’s probably better than nothing.
source share