If you want to change product attribute type from dropdown to text in Magento 2, all you need to do is to run the following SQL queries (please make a Database backup before execution):

1. This query will change the attribute settings and convert it to a text attribute.

UPDATE eav_attribute SET
backend_type = "varchar",
frontend_input = "text",
source_model = ""
WHERE attribute_code = "MY_ATTRIBUTE_CODE";

2. This query will copy dropdown attribute data to the text attribute value table and replace the option IDs with their actual labels (text).

INSERT INTO catalog_product_entity_varchar
SELECT null as value_id, pei.attribute_id, pei.store_id, pei.entity_id, aov.value as value
FROM catalog_product_entity_int pei
LEFT JOIN eav_attribute_option ao ON pei.attribute_id = ao.attribute_id
LEFT JOIN eav_attribute_option_value aov ON ao.option_id = aov.option_id
WHERE
pei.value IS NOT NULL
AND pei.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "MY_ATTRIBUTE_CODE")
AND aov.store_id = 0
AND pei.value = ao.option_id;

3. This query will delete all deprecated data for the dropdown attribute values.

Attention! In the queries, please replace "MY_ATTRIBUTE_CODE" with your actual attribute code.

DELETE FROM  catalog_product_entity_int WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "MY_ATTRIBUTE_CODE");
DELETE s.* FROM eav_attribute_option_value s
INNER JOIN eav_attribute_option o on o.option_id = s.option_id
INNER JOIN eav_attribute a on a.attribute_id = o.attribute_id
WHERE a.attribute_code IN ('MY_ATTRIBUTE_CODE');
DELETE s.* FROM eav_attribute_option_swatch s
INNER JOIN eav_attribute_option o on o.option_id = s.option_id
INNER JOIN eav_attribute a on a.attribute_id = o.attribute_id
WHERE a.attribute_code IN ('MY_ATTRIBUTE_CODE');
DELETE FROM  eav_attribute_option WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "MY_ATTRIBUTE_CODE");

4. Flush the Magento cache and check.