You want to know if any test with that unique id was cancelled?
Well if you use something like a bit you can read it as boolean and it would be true=1, which yields something you can refine with a where more and put in a stored procedure if you like
declare @tbl table(
id int,
uniqueid int,
name nvarchar(10),
result nvarchar(20)
)
insert into @tbl(id, uniqueid, name, result)
values(1,1, 'Test1', 'OK')
insert into @tbl(id, uniqueid, name, result)
values(2,1, 'Test1', 'Cancelled')
insert into @tbl(id, uniqueid, name, result)
values(4,2, 'Test2', 'OK')
insert into @tbl(id, uniqueid, name, result)
values(5,2, 'Test1', 'OK')
select a.uniqueid, case when a.result = 'Cancelled' then 1 else 0 end wascancelled
from
(select distinct uniqueid, min(Result) result
from @tbl
group by uniqueid) a