Rather than dump the entire database to a script file, I would instead use the
Information Schema.
For your example, to determine the table/field existence:
Code:
Select table_name, column_name
From information_schema.columns
Where Table_Name = 'your_tablename' and schema_name = 'your_schemaname'
The records returns using the above query are the table name and column name(s) which are defined in the database.
If no records are returned, then there are no columns defined. (which would imply that the table doesn't exist... although it is possible, I suppose, that someone created a table, then deleted all the columns from that table.)
To verify table existence, whether columns exist or not, use
Code:
Select table_name, table_type
From information_schema.tables
Where Table_Name = 'your_tablename' and schema_name = 'your_schemaname'
If a record is returned, your table exists.