Naming output files is always tricky. This sample shows how to use message context properties to control the name of output files.
BizTalk 2004 has two ways to dynamically name your files from inside the Orchestration. The two ways to accomplish this are either to use a Dynamic Send Port or to use the %SourceFileName% macro on the Send Port.
This sample should work with both BizTalk 2004 and BizTalk 2006.
Get more information from the original blog post on this topic: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2004/11/13/how-to-name-output-files-inside-an-orchestration.aspx