Came across this code today. Sticking it in my personal 'Wat?' file (https://www.destroyallsoftware.com/talks/wat/)
Lump this in with the "hey, did you know you can DECLARE and set to a value without being inside a SP"?
This code works on 2008 and higher.
DECLARE @i INT = 1
WHILE @i < 5
DECLARE @a INT = 4
SET @i = @i+1