[COLOR=blue]DECLARE[/color] @TableId [COLOR=blue]int[/color]
[COLOR=blue]SELECT[/color] @TableId = [COLOR=#FF00FF]OBJECT_ID[/color]([COLOR=red]'TempDB..##Test'[/color])
@TableId
[COLOR=blue]IF[/color] @TableId [COLOR=blue]IS[/color] NULL
[COLOR=green]-- Table does not exists
[/color][COLOR=blue]ELSE[/color]
[COLOR=green]-- Table does exists[/color]