Try the following script if my guessing is correct:
DECLARE @Student TABLE (
[Id] int,
[Role] varchar (100),
[Name] varchar (100)
);
INSERT INTO @Student VALUES
(1, 'Student | Teacher | other', 'dinesh'),
(2, 'Student | Teacher | other', 'dinu'),
(3, 'Student | Teacher | other', 'kal');
SELECT Id,
CASE
WHEN [Id] = 1 THEN RTRIM(LEFT([Role], CHARINDEX('|', [Role]) - 1))
WHEN [Id] = 2 THEN LTRIM(RTRIM(SUBSTRING([Role], CHARINDEX('|', [Role]) + 1, CHARINDEX('|', [Role], CHARINDEX('|', [Role]) + 1 -CHARINDEX('|', [Role])))))
ELSE LTRIM(REVERSE(LEFT(REVERSE([Role]), CHARINDEX('|', REVERSE([Role])) - 1)))
END AS [Role],
[Name]
FROM @Student;
GO