Thanks so much for all your help. Using the IF statements worked. I built it down to be a little more concise just using Boolean logic
declare @idnum varchar
select @idnum = 1
declare @TC varchar(50)
select @TC = 'all'
select B.GroupDetail, C.SecID, C.TransCode, C.Quantity, B.GroupId, C.PortfolioID
FROM ERTutTransactions C
INNER JOIN FinalGroupDetail B
ON C.PortfolioID = B.PortfolioID
AND B.GroupId = @idnum
@TC = 'ALL'
( @TC IN ('BUY','SELL') AND TransCode = @TC )