Fixing escape characters in SQL Dynamic Query