refcotored code to make BindParam contain sql as well