diff --git a/tfa_basic.drush.inc b/tfa_basic.drush.inc
index b6cf224..60ccad7 100644
--- a/tfa_basic.drush.inc
+++ b/tfa_basic.drush.inc
@@ -9,10 +9,21 @@
  * Implements hook_sql_sync_sanitize().
  */
 function tfa_basic_drush_sql_sync_sanitize($site) {
-  $sql = "TRUNCATE TABLE tfa_totp_seed;";
-  $sql .= "TRUNCATE TABLE tfa_trusted_browser;";
-  $sql .= "TRUNCATE TABLE tfa_recovery_code;";
-  $sql .= "TRUNCATE TABLE tfa_accepted_code;";
+  $tables = array(
+    'tfa_totp_seed',
+    'tfa_trusted_browser',
+    'tfa_recovery_code',
+    'tfa_accepted_code',
+  );
+
+  $sql = "";
+
+  foreach ($table as $table) {
+    if (db_table_exists($table)) {
+      $sql .= "TRUNCATE TABLE ${table};";
+    }
+  }
+
   drush_sql_register_post_sync_op('tfa_basic', dt('Remove sensitive TFA data.'), $sql);
 
 }
