first thing use
select @set at the place of
exec(@set) and select * from @tTable return more than one column so we can specify the particular column here...
And one more important thing execute the all statements in one batch because table variables have present only in a single batch.
i am giving the statements..
DECLARE @tTable table(ID INT,UserName VARCHAR(20),Password VARCHAR(100),Email VARCHAR(30))
INSERT INTO @tTable SELECT * FROM Login
DECLARE @set VARCHAR(MAX)
SET @set=(SELECT [UserName] FROM @tTable WHERE ID='2')
SELECT @set