Not much different to what Solution 1 has to say, but add validation to check for a null value in the @acadamicid parameter, try this:
if(@acadamicid is not null)
begin
select @acadamicid=Acadamic_year_id from Acadamic_year where Acadamic_year_from=@yearfrom and Acadamic_year_to=@yearto;
insert into Standered_details(Standered_id,Standered_name,Branch_id,Acadamic_year_id,Created_date_time)
values(@standeredid,@standeredname,@branchid,@acadamicid,@createddatetime)
end