create proc sp_test
(@yd varchar(6),
@SupplierID int)
as
select SupplierID ,
       @yd,
       (select asum from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re = 'init')as initdata,
       (select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '1') as StockSum,
       (select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '0') as PaySum,
       (select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID ) sa Account
from table 
go