Local variables are often used as counters for while loops or if...else blocks in a batch or stored procedure.
When they are used in stored procedures, they are declared for automatic, noninteractive use by the procedure when it executes. You can use variables nearly anywhere the Transact-SQL syntax indicates that an expression can be used, such as char_expr, integer_expression, numeric_expr, or float_expr.
declare @variable_name datatype [, @variable_name datatype]...
The variable name must be preceded by the @ sign and conform to the rules for identifiers. Specify either a user-defined datatype or a system-supplied datatype other than text, image, or sysname.
In terms of memory and performance, this is more efficient:
declare @a int, @b char(20), @c float
than this:
declare @a int declare @b char(20) declare @c float