/Engine/Source/Editor/StaticMeshEditor/Public/StaticMeshEditorSubsystem.h
Find the references of the mesh MeshToBeReplaced on all the MeshComponents provided and replace it by NewMesh. The editor should not be in play in editor mode.
void ReplaceMeshComponentsMeshes ( const [TArray](API\Runtime\Core\Containers\TArray)< class [UStaticMeshComponent](API\Runtime\Engine\Components\UStaticMeshComponent) * > & MeshComponents, class [UStaticMesh](API\Runtime\Engine\Engine\UStaticMesh) * MeshToBeReplaced, class [UStaticMesh](API\Runtime\Engine\Engine\UStaticMesh) * NewMesh )