• This is what I made changes

    if ((select max(ID) from table1)=(select max(ID) from table2)) exec xp_cmdshell `sqlcmd -E -S "DBNAME\INSTANCE1" -h-1 -Q ` (

    echo executed commandshell

    start "" "D:\firstpgm\bin\Debug\firstpgm.exe"

    goto end

    )

    :end

    echo END

    Not sure if this is correct way of invoking.