Pass Variable declared in SQL to another SQL Query

the declare works fine for setting the variable within the sql statment. But how do i get the variable CustomerId passed to a new sql query?