Effective action for higher spin fields on (A)dS backgrounds