You need to generate a new sendmail.cf.
On solaris 9 cd to /usr/lib/sendmail/cf
copy main.mc to local.mc
edit it and add the line
MASQUERADE_AS(example.com)
before the MAILER lines
do a "make local.cf".
Copy local.cf to /etc/mail/sendmail.cf
and restart sendmail.
On solaris 10, the process is similar, but the directory involved is /etc/mail/cf/cf
It also heavily depends what you use to send the mail. Normally the so called MUA (mail user agent) can set its own 'from' adress. So, suppose you're using the 'mail(1)' command tool then all you'd need to do is include a 'From:' header.
IMO thats a lot better than to mess with sendmail since modifying sendmail behaviour will change this system-wide, so all users who send mail will have the same kind of from domain, which isn't always what you want.