Ahmed,
I see you are using dbo.castTime function. Unfortunately, I can not tell what this function does.
here is the average as I see it:
SELECT
a.[ticket_id]
,a.[created_on]
,a.[created_by]
,b.[done_by]
,b.[status_changed_to]
,b.[update_time]
--,dbo.CastTime(datediff(s,a.created_on,b.update_time)) as Time_Ticket
,datediff(minute, a.create_on, b.update_time) as time_ticket
FROM [ticket] a (nolock)
INNER JOIN [ticket_history] b (nolock)
ON a.ticket_id = b.ticket_id
where
(datepart(mm,a.created_on)>=4
and datepart(mm,b.update_time)<=4)
and (datepart(yyyy,a.created_on)=2012
and datepart(yyyy,b.update_time)=2012)
and status_changed_to ='Close'
ORDER BY a.created_on