Dont use transaction for inserting values into temp table.
create procedure [dbo].[temptable] (@branchid int,@academicyearid int)
as
begin
set nocount on
declare @branchname varchar(50)
declare @acfy int ;
declare @acty int
select @branchname=Branch_name from Branch where Branch_id=@branchid
select @acfy=Acadamic_year_from,@acty=Acadamic_year_to from Acadamic_year where Acadamic_year_id=@academicyearid
create table #temptable(Brach_name int,Acadamic_year_from smallint,Acadamic_year_to smallint)
insert into #temptable(Brach_name,Acadamic_year_from,Acadamic_year_to)values(@branchname,@acfy,@acty)
select * from #temptable;
end
exec temptable 141,11