I've found a way to get intermediate values back from my function.
Here is my example :
create function dbo.MyFunction(@Arg1 int, @Arg2 int)
returns @DebugTable TABLE(Col1 varchar(255) null)
as
begin
declare @MyVariable int
--
-- some calculations to...