
IF EXISTS
(
    SELECT *
    FROM SYS.OBJECTS
    WHERE OBJECT_ID = OBJECT_ID(N'EST_NF_SAI_NFE_AUT_PBM')
          AND TYPE IN(N'U')
)
    BEGIN
        DROP TABLE EST_NF_SAI_NFE_AUT_PBM;
        CREATE TABLE EST_NF_SAI_NFE_AUT_PBM
        (CD_EMP            INT NOT NULL, 
         CD_FILIAL         INT NOT NULL, 
         CD_NF             INT NOT NULL, 
         STS_AUT_PBM       INT NOT NULL, 
         TP_PBM            INT NOT NULL, 
         OPERADORA_SELECAO INT NOT NULL, 
         NOME_OPERADOR     VARCHAR(255) NOT NULL, 
         NR_AUTR_PBM       VARCHAR(150)
         CONSTRAINT PK_EST_NF_SAI_NFE_AUT_PBM PRIMARY KEY(CD_EMP, CD_FILIAL, CD_NF)
        );
END;
ELSE 

        CREATE TABLE EST_NF_SAI_NFE_AUT_PBM
        (CD_EMP            INT NOT NULL, 
         CD_FILIAL         INT NOT NULL, 
         CD_NF             INT NOT NULL, 
         STS_AUT_PBM       INT NOT NULL, 
         TP_PBM            INT NOT NULL, 
         OPERADORA_SELECAO INT NOT NULL, 
         NOME_OPERADOR     VARCHAR(255) NOT NULL, 
         NR_AUTR_PBM       VARCHAR(150)
         CONSTRAINT PK_EST_NF_SAI_NFE_AUT_PBM PRIMARY KEY(CD_EMP, CD_FILIAL, CD_NF))