Pretty much, you can't - particularly when it comes to table and column names without actually running the query against SQL server. It's possible, but it would be a huge investment in effort to try and check every detail before you ran a query.
The best way would probably be to "test run" the query on the server within a transaction and always roll the transaction back. That way, if there were any problems (but part of it had an effect) it would not cause any changes to the DB anyway.
Use a
try-catch-finally
block, and rollback the transaction in the
finally
and it should give you a "success" / "fail" indication.
SqlTransaction Class (System.Data.SqlClient)[
^]