I'm not sure what you mean by "test." The result from a SQL query is dependant upon the query (some queries return nothing, some return success/failure, some the number of rows modified).
If you're looking to see if the command itself failed (i.e. missing file, malformed SQL, etc.) then wrap your command/query in a TRY /CATCH and handle the exception accordingly.