You are getting errors because you have used reserved words for column and table names
user
,
end
,
name
.
All you need to do is surround those names with square brackets i.e.
select [name]
from [user] where profile_id in
(
select profile_id
from experience where company_name='TCS' and ((year([end])>='2012' and year(start)<='2012') or [end] is null)
) order by [name];
Your checking of year(end) is also a little messy - you only need to check for equality because you are only looking at the datepart Year...
select [name]
from [user] where profile_id in
(
select profile_id
from experience where company_name='TCS' and (year([end]) = 2012 or [end] is null)
) order by [name];
A better approach to using the sub-query on table experience would be to use an INNER JOIN - that way only data that matches both tables will be returned. I.e.
select [name]
from [user] U
INNER JOIN experience E ON U.profile_id = E.profile_id
where E.company_name='TCS' and (year(E.[end]) = 2012 or E.[end] is null)
order by [name];