One funny (or annoying) thing about T-SQL is that it does not allow you to declare variables (or create temp tables) with the same name in mutually exclusive units of code. Here's an example of what I mean:
DECLARE @test bit
SET @test = 0
IF (@test = 0)
BEGIN
DECLARE @monkey int
END
ELSE
BEGIN
DECLARE @monkey int
END
If you run that in Query Analyzer you'll get the following message:
Server: Msg 134, Level 15, State 1, Line 11
The variable name '@monkey' has already been declared. Variable names must be unique within a query batch or stored procedure.