Fix table prefix & sql params properly