With a hash table, ini file or a set of %variable you can keep your nick as entry/item/name and the password for that nick as it's value. For example:
on ns:NOTICE:*IDENTIFY*:?:identify %id. [ $+ [ $me ] ]

I think /msg $nick can be dangerous for such idents, most NickServs allow /ns identify <pass> or /nickserv identify <pass>, this way you're sure it never gets sent to someone faking nickserv...