It is evaluated at compile time. When your code (function or stored procedure) starts to execute, all DECLARE-d variables are ready for action.
An example:
IF (1=0) BEGIN
DECLARE @some TABLE(
number int)
INSERT INTO @some VALUES (12)
END
INSERT INTO @some VALUES (23)
SELECT * FROM @some
If DECLARE was an instruction, it should fail at compile, since @some is not known to exist or not. But it's not the case.
@some is declared, but the value 12 is not inserted, since the IF condition is false. However, the second insert does.
That's all folks!