This is a terrible design and should be replaced with a better one if possible.
If re-designing is not possible then this answer by Eduard Uta is a good one, but still has one drawback compared to my suggested solution:
It assumes that the Subcomponent will always contain exactly one letter and a number, and that the range specified in the table has the same letter in both sides. a range like AB1 to AC100
might be possible (at least I don't think there's a way to prevent it using pure t-sql).
This is the only reason I present my solution as well. Eduard already got my vote up.
DECLARE @Var varchar(50) = 'C50'
-- also try 'AB150' and 'C332'
;WITH CTE AS (
SELECT Sno, Comp, SubComp,
LEFT(FromValue, PATINDEX('%[0-9]%', FromValue)-1) As FromLetter,
CAST(RIGHT(FromValue, LEN(FromValue) - (PATINDEX('%[0-9]%', FromValue)-1)) as int) As FromNumber,
LEFT(ToValue, PATINDEX('%[0-9]%', ToValue)-1) As ToLetter,
CAST(RIGHT(ToValue, LEN(ToValue) - (PATINDEX('%[0-9]%', ToValue)-1)) as int) As ToNumber
FROM
(
SELECT Sno, Comp, SubComp,
LEFT(SubComp,
CASE WHEN CHARINDEX(' to ', SubComp) > 0 THEN
CHARINDEX(' to ', SubComp)-1
WHEN CHARINDEX(',', SubComp) > 0 THEN
CHARINDEX(',', SubComp)-1
END
) FromValue,
RIGHT(SubComp,
CASE WHEN CHARINDEX(' to ', SubComp) > 0 THEN
LEN(SubComp) - (CHARINDEX(' to ', SubComp) + 3)
WHEN CHARINDEX(',', SubComp) > 0 THEN
CHARINDEX(',', SubComp)-1
END
) ToValue
FROM T
) InnerQuery
)
SELECT Sno, Comp, SubComp
FROM CTE
WHERE LEFT(@Var, PATINDEX('%[0-9]%', @Var)-1) BETWEEN FromLetter AND ToLetter
AND CAST(RIGHT(@Var, LEN(@Var) - (PATINDEX('%[0-9]%', @Var)-1)) as int) BETWEEN FromNumber And ToNumber
sqlfiddle here