to suppress the error from the log, check for column names before executing SQL

Fixes #2681