Execute Sql Query With If Statement