
IF not exists(
  SELECT* FROM INFORMATION_SCHEMA.COLUMNS 
  WHERE COLUMN_NAME = 'id_formaDePago' AND TABLE_NAME = 'ter_tercero'
  )
  BEGIN
  ALTER TABLE ter_tercero
  ADD id_formaDePago int null

   ALTER TABLE ter_tercero
   ADD FOREIGN KEY (id_formaDePago) REFERENCES doc_formapago(Id);
  END;


IF not exists(
  SELECT* FROM INFORMATION_SCHEMA.COLUMNS 
  WHERE COLUMN_NAME = 'tiempoEntrega' AND TABLE_NAME = 'ter_tercero'
  )
  BEGIN
  ALTER TABLE ter_tercero
  ADD tiempoEntrega int null
  END;


