Computes the SQL_ID of a query string