>If you are going to work as a consultant for
>a business that has an existing software program
>what things should be included in a written agreement?
>
The question is much to broad to address as stated. For example, what exactly do you mean by consulting? Do they own the source to the existing software outright? Will they be reselling it? Will you be reselling any of the modifications? "Consulting" covers a very broad range of activities, so you need to be more specific about what exactly you are doing, andd what will be done with the work product.
The single piece of advice I'd give you is to get an attorney who knows contract law to draft and review any agreement. There's at least as much involved in the language of contract law as there is in programming, and if your agreement is not drawn up in accordance with the law, it will almost inevitably cost you more than you'd pay for a well-drafted contract agreement.