You could always do a LEFT JOIN and just specify a filter based on your @innerjoin parameter
[font="Courier New"]select *
from tableA ta
left join tableB tb on tb.idA=ta.idA
left join tableC tc on tc.idB=tb.idB
where
ta.param1 = @param1
and (@innerjoin = false or ta.param2 = @param2)
AND (@innerjoin = false or tb.idA is not null)
AND (@innerjoin = false or tc.idB is not null)[/font]