I am trying to achieve like an Apex invoke-able method that takes input Object Name, field(s) to update, values for the corresponding field, Ids to use in query, the Apex method will query based on parameters and update passed fields with values.
Or, Could I create a formula field under an object that has all my apex code like SELECT statement diff_object, Ids passed to operate on, fields to update, values to set, update statement at end.
Then invoke Apex method from Process builder, pass this formula field as input, apex understands and run the logic.