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