You may have leading and/or trailing tabs instead of spaces which the trim's won't replace. You can use CHARINDEX to find CHAR(9) in a string and then use the replace function if that is the issue.
/****** Script for SelectTopNRows command from SSMS ******/
DECLARE @REALNAME varchar(255)
SET @REALNAME = ' Ricki Ricardo'
select LEN(@realname)
select len(RTRIM(ltrim(@realname)))
SET @REALNAME = 'Ricki Ricardo'
select LEN(@realname)
select len(RTRIM(ltrim(@realname)))