Answer for SEO Query – Image Alt Text replaced with generic text in HMTL

Hello, try to use the following code.

alt="<?php echo get_post_meta( get_attachment_id_by_url( wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) ), '_wp_attachment_image_alt', true ); ?>"