Add param substitution to queries