I hope you want to filter the records those have the space in the last position.
DECLARE @TestTable TABLE (Data VARCHAR(20));
INSERT INTO @TestTable (Data) VALUES ('xyz'), ('Sharma ');
SELECT * FROM @TestTable WHERE Data = 'Sharma ';
SELECT * FROM @TestTable WHERE Data = 'Sharma';
you will get the same result for WHERE Data = 'Sharma ' and 'Sharma'
Using SUBSTRING(Data, DATALENGTH(Data), 1)
you can get the last character of the column and add the condition in WHERE clause will solve your problem:
DECLARE @TestingValue AS VARCHAR(20) = 'Sharma'; -- 'xyz' -- 'Sharma '
SELECT * FROM @TestTable WHERE Data = @TestingValue AND SUBSTRING(@TestingValue, DATALENGTH(@TestingValue), 1) = ' ' ;
The above block return result if you set 'Sharma '
as parameter value.