Everything depends on the following:
- are you hosts managed by vcenter?
- are they in DRS cluster? if yes what is an automation level?
- are VMs on shared datastore or not?
Generally speaking if you have fully automated DRS cluster and all VMs are located on shared datastore you can just enter one host into maintenance mode > shutdown it > add RAM > power on it > exit host from maintenance mode.
Than repeat the same actions with other hosts.