Fixed bug on empty params in query procedures

Also, the @param=SQL is now supported on query procedure.