template query replaced with parametrized query