/Engine/Source/Editor/StaticMeshEditor/Public/StaticMeshEditorSubsystem.h
Find the references of the material MaterialToReplaced on all the MeshComponents of all the Actors provided and replace it by NewMaterial.
void ReplaceMeshComponentsMaterialsOnActors ( const [TArray](API\Runtime\Core\Containers\TArray)< class [AActor](API\Runtime\Engine\GameFramework\AActor) * > & Actors, class [UMaterialInterface](API\Runtime\Engine\Materials\UMaterialInterface) * MaterialToBeReplaced, class [UMaterialInterface](API\Runtime\Engine\Materials\UMaterialInterface) * NewMaterial )